package com.yyt.qrcode.controller;

import com.yyt.qrcode.utils.QRCodeDemo;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.OutputStream;

/**
 * @author yeyangtao
 * @date 2020/5/25 14:46
 */
@Controller
public class QRCodeController {
    @RequestMapping("/create")
    public void createQrCode(HttpServletRequest request, HttpServletResponse response) {
        try {
            OutputStream os = response.getOutputStream();
            QRCodeDemo.encode("http://www.baidu.com", "", os, true);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
